package com.zimu.example.controller;

import com.blade.mvc.annotation.GetRoute;
import com.blade.mvc.annotation.Param;
import com.blade.mvc.annotation.Path;
import com.blade.mvc.http.Response;
import com.zimu.example.model.Person;

/**
 * @author : zimu
 * @Date: 2018/7/19 17:00
 * @description : ResponseController
 */
@Path("res")
public class ResponseController {
    @GetRoute("json")
    public void printJson(Response response) {
        Person person = new Person();
        person.setId(21);
        person.setName("zimu");
        response.json(person);
    }

    @GetRoute("cookie")
    public void writeCookie(@Param String c, Response response) {
        response.cookie("test", c);
    }

    @GetRoute("r")
    public void redirect(Response response) {
        response.redirect("https://www.baidu.com");
    }
}
